﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ORMAC.Core;

namespace ORMAC
{
    public sealed class ORMACTools
    {
        /// <summary>
        /// Returns the type table name
        /// </summary>
        /// <typeparam name="T">the class type</typeparam>
        /// <returns></returns>
        public static string GetTableName<T>()
        {
            return ReflectionHelper.TableName<T>("");
        }
        public static string GetTableName(Type classType)
        {
            return ReflectionHelper.TableName(classType,"");
        }
        public static string GetTableName(object tableObject)
        {
            return ReflectionHelper.TableName(tableObject.GetType(), "");
        }
        /// <summary>
        /// Returns a list of all fields which are mapped to DB columns along with their string values in the object
        /// </summary>
        /// <typeparam name="T">Class Type</typeparam>
        /// <param name="container">Object of class type</param>
        /// <returns></returns>
        public static Dictionary<string,string> GetFieldVlauePairs<T>(T container)
        {
            return ReflectionHelper.GetFieldValuePairs(container);
        }
        public static Dictionary<string, string> GetFieldVlauePairs(object container)
        {
            return ReflectionHelper.GetFieldValuePairs(container);
        }
    }
}
